1. Field of the Invention
The present invention relates to the field of data access. More specifically, the present invention relates to methods, systems, and computer program products for converting a single expression that references multiple branches within a hierarchical schema into multiple expressions that each reference a single branch of the hierarchical schema.
2. Background and Related Art
Using hierarchical schemas to define data relationships is becoming increasingly popular. These hierarchical schemas often use tags or markups to define data elements and attributes. One currently popular technology for defining hierarchical schemas and marking up data is eXtensible Markup Language (“XML”). Among other reasons, XML is popular because it provides significant flexibility in exchanging data between computer systems.
Storage mechanisms for data defined by hierarchical schemas may take a variety of forms and are not necessarily specific or native to the underlying hierarchical schema. Although native storage mechanisms typically offer performance, design, and other benefits, there are often significant resource requirements for supporting multiple native storage mechanisms. For example, relational database management systems (“RDBMSs”) supporting Structured Query Language (“SQL”) are commonplace in many organizations. As a result, RDBMSs are likely to make use of existing hardware, software, support and administration personnel, design expertise, etc., whereas introducing some other storage mechanism is more likely to require additional hardware, software, training, and personnel. Accordingly, using an RDBMS is attractive even if a relational data model lacks native support for some external aspects of a particular hierarchical model.
One problem that may be encountered in using an SQL database to store XML data relates to differences in how XML and SQL data may be referenced. For example, depending on the implementation, it may be possible for an SQL statement to select the data corresponding to only a single schema branch, whereas in general, XML may reference multiple schema branches at varying levels within the hierarchy. In other words, XML allows for ambiguity in referencing schema branches (e.g., expressions that include “*” or “|” or “//”) that may not be supported in an SQL database. For purposes of illustration, consider a shipping record that includes a number of schema date elements, such as a current date, an order date, a shipping date, a backorder date, etc. Using XML, it may be possible to reference all date elements with a single expression. However, referencing the same date elements in SQL may require multiple expressions. In converting from an XML expression to an SQL expression, it may be desirable or necessary to remove the ambiguity (i.e., the referencing of multiple schema elements) from the XML expression.
More generally, similar problems may be encountered when converting queries or expressions from any language to another, because an expression in one language may require multiple expressions in the other. XML and SQL merely provide examples of queries or expressions that may lead to this problem. Accordingly, methods, systems, and computer program products for converting a single expression that references multiple branches within a hierarchical schema into multiple expressions that each reference a single branch of the hierarchical schema are desired.